import { defineStore } from "pinia";
// 定义一个仓库
export const useCounterStore = defineStore("counter", {
  // 相当于vue3中的ref或reactive
  state: () => ({
    name:localStorage.getItem("name"),
  }),
  //   计算属性相当于vue3中的computed
  //   getters: {
  //     doubleCount: (state) => state.count * 2,
  //   },
  actions: {
    updateName(newname) {
      this.name = newname;
      localStorage.setItem("name", newname);
    },
  },
});
